package cdms.db;

import java.util.List;
import cdms.domain.Sender;
import cdms.web.PaginationSupport;

/**
 * 
 * <p>
 * Project name:CDMS
 * </p>
 * <p>
 * Class name:SenderRepository
 * </p>
 * 
 * @author "JiHongru"
 * @version 1.0
 * @date 2019年11月17日下午1:38:06
 * @description Data access interface
 *
 */
public interface SenderRepository {

	/**
	 * Get sender accounts Quantity
	 * 
	 * @return long
	 */
	long count();

	/**
	 * count senders by username
	 * 
	 * @param username
	 * @return long
	 */
	long countByUserName(String username);

	/**
	 * count senders by fullname
	 * 
	 * @param fullname
	 * @return long
	 */
	long countByFullName(String fullname);

	/**
	 * Save a sender account
	 * 
	 * @return Sender
	 * @param Sender
	 */
	Sender save(Sender sender);

	/**
	 * delete a sender by id
	 * 
	 * @param senderId
	 * @return boolean
	 */
	boolean delete(long senderId);

	/**
	 * Get a sender account by id
	 * 
	 * @return Sender
	 * @param long
	 */
	Sender findOneById(long id);

	/**
	 * Get a sender account by username
	 * 
	 * @return Sender
	 * @param String
	 */
	Sender findOneByUserName(String username);

	/**
	 * Get a sender account by username and password
	 * 
	 * @return Sender
	 * @param String
	 * @param String
	 */
	Sender findOneByUsernameAndPassWord(String username, String password);

	/**
	 * 
	 * 
	 * <p>
	 * Title: updateFullNamePasswordPhoneNoById
	 * </p>
	 * 
	 * <p>
	 * Description:
	 * </p>
	 * 
	 * @param fullname
	 * @param password
	 * @param phoneNo
	 * @return
	 */
	Sender updateUserNameFullNamePasswordPhoneNoById(Sender sender);

	/**
	 * Get all sender accounts
	 * 
	 * @return List<Sender>
	 */
	List<Sender> findAll();

	/**
	 * update sender information
	 * 
	 * @param sender
	 * @return Sender
	 */
	Sender update(Sender sender);

	/**
	 * Get a page of senders
	 * 
	 * @return PaginationSupport<Sender>
	 */
	PaginationSupport<Sender> findPage(int pageNo, int pageSize);

	/**
	 * Get a page of senders by username
	 * 
	 * @param int    pageNo
	 * @param int    pageSize
	 * @param String username
	 * @return PaginationSupport<Sender>
	 */
	PaginationSupport<Sender> searchByUserName(int pageNo, int pageSize, String username);

	/**
	 * Get a page of senders by fullname
	 * 
	 * @param int    pageNo
	 * @param int    pageSize
	 * @param String fullname
	 * @return PaginationSupport<Sender>
	 */
	PaginationSupport<Sender> searchByFullName(int pageNo, int pageSize, String fullname);

	/**
	 * Get the number of online senders
	 * 
	 * @return
	 */
	int onlineCount();

	/**
	 * Update the sender online by userName
	 * 
	 * @param isOnline
	 * @param userName
	 * @return
	 */
	boolean updateOnline(boolean isOnline, String userName);
}
